import { defHttp } from '@/utils/http/axios';
import { IBusinessOpportunity, IBusinessOpportunityList, IBusinessOpportunityReviewList, ICooperationType, IFollowRecord, IFollowRecordFrom, IOpDataCount, IOrgList, IPushConfig, ReviewData } from './model/businessOpportunitiesManageModel';
import { BasicFetchResult } from '../model/baseModel';
enum Api {
    promotionReviewList = '/admin/org/bo/promotion-review/list',
    promotionReviewDetail = "/admin/org/bo/promotion-review/detail",
    opDetail = "/admin/org/bo/promotion-review/info",
    getOpDataCount = "/admin/org/bo/count/data",
    opReview = "/admin/org/bo/promotion-review/review",
    getCooperationType = "/admin/bo/cooperationType/list",
    boLibList = "/admin/org/bo/list",
    boLibColse = "/admin/org/bo/close",
    boInfo = "/admin/org/bo/info",
    followAddOrUpdate = "/admin/org/bo/follow/addOrUpdate",
    followList = "/admin/org/bo/follow/list",
    boDetail = "/admin/org/bo/detail",
    crossClubObList = "/admin/org/bo/unionMap/list",
    crossClubObColse = "/admin/org/bo/unionMap/close",
    boUnionMapDetail = "/admin/org/bo/unionMap/detail",
    boUnionMapPushConfig = "/admin/org/bo/unionMap/pushConfig",
    orgBoManagerList = "/admin/org/bo/manager/list",
    orgBoManagerConfig = "/admin/org/bo/manager/config",
    crossClubObRemove = "/admin/org/bo/unionMap/remove",
}
/**
 * @description 供需审核列表
 * @date 13/07/2022
 * @export
 */
export function promotionReviewList(params: any) {
    return defHttp.post<IBusinessOpportunityReviewList>({
        url: `${Api.promotionReviewList}?current=${params.current}&size=${params.size}`,
        params,
    });
}

/**
 * 审核详情
 * @param id 
 * @returns 
 */
export function promotionReviewDetail(id: number) {
    return defHttp.post<IBusinessOpportunityReviewList>({
        url: Api.promotionReviewDetail,
        params: { id },
    });
}

/**
 * 供需详情基本信息
 * @param id 
 * @returns 
 */
export function boInfo(id: number) {
    return defHttp.post<IBusinessOpportunity>({
        url: Api.boInfo,
        params: { id },
    });
}

/**
 * 供需详情(审核)
 * @param id 
 * @returns 
 */
export function opReviewDetail(id: number) {
    return defHttp.post<IBusinessOpportunity>({
        url: Api.opDetail,
        params: { id },
    });
}
/**
 * 供需详情
 * @param id 
 * @returns 
 */
export function boDetail(id: number) {
    return defHttp.post<IBusinessOpportunityReviewList>({
        url: Api.boDetail,
        params: { id },
    });
}

/**
 * 跨会供需详情
 * @param id 
 * @returns 
 */
export function boUnionMapDetail(id: number) {
    return defHttp.post<IPushConfig>({
        url: Api.boUnionMapDetail,
        params: { id },
    });
}

/**
 * 推广设置
 * @param params 
 * @returns 
 */
export function boUnionMapPushConfig(params) {
    return defHttp.post({
        url: Api.boUnionMapPushConfig,
        params,
    });
}

/**
 * 供需数据统计
 * @param id 
 * @returns 
 */
export function getOpDataCount(id: number) {
    return defHttp.post<IOpDataCount>({
        url: Api.getOpDataCount,
        params: { id },
    });
}

/**
 * 审核
 * @param data 
 * @returns 
 */
export function opReview(params: ReviewData) {
    return defHttp.post({
        url: Api.opReview,
        params,
    });
}

/**
 * 查询合作类型列表
 * @returns 
 */
export function getCooperationType() {
    return defHttp.get<ICooperationType[]>({
        url: Api.getCooperationType,
    });
}


/**
 * 供需库列表
 * @param params 
 * @returns 
 */
export function boLibList(params: any) {
    return defHttp.post<BasicFetchResult<IBusinessOpportunityList>>({
        url: `${Api.boLibList}?current=${params.current}&size=${params.size}`,
        params,
    });
}
/**
* 跨会供需列表
* @param params 
* @returns 
*/
export function crossClubObList(params: any) {
    return defHttp.post<BasicFetchResult<IBusinessOpportunityList>>({
        url: `${Api.crossClubObList}?current=${params.current}&size=${params.size}`,
        params,
    });
}

/**
 * 供需库关闭供需
 * @param id 
 * @returns 
 */
export function boLibColse(id: number) {
    return defHttp.post({
        url: Api.boLibColse,
        params: { id },
    });
}

/**
 * 跨会关闭供需
 * @param id 
 * @returns 
 */
export function crossClubObColse(id: number) {
    return defHttp.post({
        url: Api.crossClubObColse,
        params: { id },
    });
}

/**
 * 移除供需
 * @param id 
 * @returns 
 */
export function crossClubObRemove(id: number) {
    return defHttp.post({
        url: Api.crossClubObRemove,
        params: { id },
    });
}


/**
 * 跟进记录新增，编辑
 * @param params 
 * @returns 
 */
export function followAddOrUpdate(params: IFollowRecordFrom) {
    return defHttp.post({
        url: Api.followAddOrUpdate,
        params
    });
}

/**
 * 跟进记录列表
 * @param params 
 * @returns 
 */
export function followList(boInfoId: number) {
    return defHttp.post<BasicFetchResult<IFollowRecord>>({
        url: `${Api.followList}?current=1&size=999`,
        params: { boInfoId }
    });
}


/**
 * 组织管理列表
 * @param params 
 * @returns 
 */
export function orgBoManagerList(params) {
    return defHttp.post<BasicFetchResult<IOrgList>>({
        url: `${Api.orgBoManagerList}?current=${params.current}&size=${params.size}`,
        params
    });
}

/**
 * 供需共享配置
 * @param params 
 * @returns 
 */
export function orgBoManagerConfig(params) {
    return defHttp.post({
        url: Api.orgBoManagerConfig,
        params
    });
}

